package com.junbao.module.main.kt

import kotlin.reflect.KProperty

/**
 *    author : Majunbao
 *    github : https://github.com/MaJunBaox
 *    time   : 2022/8/28 1:14 下午
 *    desc   :
 */
class XxxDelegate {
    private var currentValue : String = "666"

    constructor()


    operator fun getValue(thisRef:Any? , property:KProperty<*>):String{
        println("测试字段名为${property.name}的变量被访问了，当前值为${currentValue}")
        return currentValue
    }

    operator fun setValue(thisRef: Any? , property: KProperty<*> , newValue:String){
        currentValue = newValue
        println("测试字段名为${property.name}的变量被赋值了，当前值为${currentValue}，新的值$newValue")
    }
}